package com.gw.jpa.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(name = "dept")
@Setter
@Getter
//部门类
public class Dept {
    @Id
    private Integer deptno;
    @Column(name = "dname",length = 14)
    private String dname;
    @Column(name = "loc",length = 13)
    private String loc;
    @OneToMany(targetEntity = Emp.class)
    @JoinColumn(name = "e_deptno",referencedColumnName = "deptno")
    private Set<Emp> empSet;
    public Dept() {
    }

    public Dept(Integer deptno, String dname, String loc) {
        this.deptno = deptno;
        this.dname = dname;
        this.loc = loc;
    }
}
